import sched, time, os
s = sched.scheduler(time.time, time.sleep)

def red_led_on():
    print time.time(), 'red_led on'
    #os.system('/usr/local/bin/ts7500ctl --redledon')
    s.enter(4, 1, red_led_off, ())

def red_led_off():
    print time.time(), 'red_led off'
    #os.system('/usr/local/bin/ts7500ctl --redledoff')
    s.enter(6, 1, red_led_on, ())

def green_led_on():
    print time.time(), 'green_led on'
    #os.system('/usr/local/bin/ts7500ctl --greenledon')
    s.enter(1, 1, green_led_off, ())

def green_led_off():
    print time.time(), 'green_led off'
    #os.system('/usr/local/bin/ts7500ctl --greenledoff')
    s.enter(2, 1, green_led_on, ())

red_led_on()
green_led_on()
s.run()
